package com.hospital.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hospital.domain.pojo.Bed;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BedMapper extends BaseMapper<Bed> {
    
    @Select("SELECT * FROM bed WHERE wId = #{wId}")
    List<Bed> selectByWard(Integer wId);
    
    @Select("SELECT * FROM bed WHERE bState = 1")
    List<Bed> selectAvailable();
    
    @Update("UPDATE bed SET bState = #{state} WHERE bId = #{bId}")
    int updateBedState(Integer bId, Integer state);
}
